﻿//SciChartViewModel.cs
//Copyright (c) 2013 StockSharp LLC, all rights reserved.
//This code module is part of StockSharp library.
//This code is licensed under the GNU GENERAL PUBLIC LICENSE Version 3.
//See the file License.txt for the license details.
//More info on: http://stocksharp.com

namespace StockSharp.Xaml
{
	using System.Collections.ObjectModel;

	using Abt.Controls.SciChart;

	class SciChartViewModel : SciChartBaseViewModel
	{
		public SciChartViewModel()
		{
			SelectedTheme = "BrightSpark"; // BlackSteel, ExpressionLight, ExpressionDark, Chrome, BrightSpark
			XVisibleRange = new IndexRange(0, int.MaxValue);
			MinimumRange = 50;
		}

		private string _theme;

		public string SelectedTheme
		{
			get { return _theme; }
			set { SetField(ref _theme, value, "SelectedTheme"); }
		}

		public int MinimumRange { get; set; }

		private IndexRange _xAxisVisibleRange;

		public IndexRange XVisibleRange
		{
			get { return _xAxisVisibleRange; }
			set
			{
				if (value.Diff < MinimumRange)
					value = new IndexRange(value.Min, value.Min + MinimumRange);

				SetField(ref _xAxisVisibleRange, value, "XVisibleRange");
			}
		}

		private ObservableCollection<SciChartPaneViewModel> _paneViewModels =
			new ObservableCollection<SciChartPaneViewModel>();

		public ObservableCollection<SciChartPaneViewModel> ChartPaneViewModels
		{
			get { return _paneViewModels; }
			set { SetField(ref _paneViewModels, value, "ChartPaneViewModels"); }
		}
	}
}